-
-
Notifications
You must be signed in to change notification settings - Fork 199
Upgrade Rails to 7.1 #2250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Upgrade Rails to 7.1 #2250
Conversation
This upgrades the gem, and following commits will change configuration, using the "rails app:update" process.
This amended all the configuration files with manually-edited new diffs, getting rid of outdated configuration where known to be outdated. We wish to keep close to the default configuration, to make updates using these diff scripts easy.
Zeitwerk is the code loader in Rails. It expects files to define classes by a convention that it explains very clearly: Zeitwerk::NameError: expected file /home/runner/work/planner/planner/lib/services/event_calendar.rb to define constant Services::EventCalendar, but didn't
In order to avoid Zeitwerk expectations failing.
These files are meant to be used during upgrades, not kept around.
These are meant to be dropped after updating to a version. We are currently setting all of these defaults, using a defaults setting in config/application.rb, so the file no longer does anything.
One model needed changing: that callback is run in another order (now: Rails runs them in the declared order, not the reverse order, as before). One test needed to not require code on its own.
When we have run this code for a while, we can remove this Rails 7.0-compatible fallback code. The links in the code comment lead to where we need to change when we upgrade, one more time.
@matyikriszta we got to done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 🎉 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice PR, easy to follow each step.
Let's merge this with a rebase, so we can use git bisect
to easily determine which commit causes problems, in case of ... well, problems :)
This PR upgrades the code base to use Rails 7.1. It is a part of upgrading Rails to latest stable release. Our method is the recommended "one minor at a time".
The PR is now draft, and will be turned into a regular PR when ready for it.The PR is ready for review!cc @mroderick.
Errors to fix
Zeitwerk::NameError: expected file /home/runner/work/planner/planner/lib/services/event_calendar.rb to define constant Services::EventCalendar, but didn't # ./vendor/bundle/ruby/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/callbacks.rb:31:in 'Zeitwerk::Loader::Callbacks#on_file_autoloaded'
Unpermitted parameter: :format. Context: { controller: ChapterController, action: show, request: #<ActionDispatch::Request:0x000000012c45bc30>, params: {"controller" => "chapter", "action" => "show", "id" => "apple-touch-icon", "format" => "png"} } Chapter Load (11.6ms) SELECT "chapters".* FROM "chapters" WHERE "chapters"."active" = $1 AND "chapters"."slug" = $2 LIMIT $3 [["active", true], ["slug", "apple-touch-icon"], ["LIMIT", 1]] ↳ app/controllers/chapter_controller.rb:3:in 'ChapterController#show' Completed 404 Not Found in 593ms (ActiveRecord: 49.0ms | Allocations: 118818)
spec/lib/verifier_spec.rb:9
make the Verifier test pass - there is a setting that upgrades the verifier serialization, assess impact of upgrading it1) Verifier generates access_token for an id Failure/Error: expect(Verifier.new(id: 1).access_token).to be_eql('BAhpBg==--30d45b871c77098a0ba79cf27dd532650ca75531') expected `"MQ==--a3487195ba15b69d4aa07b7da0234463b82c96b3".eql?("BAhpBg==--30d45b871c77098a0ba79cf27dd532650ca75531")` to be truthy, got false # ./spec/lib/verifier_spec.rb:9:in 'block (2 levels) in <top (required)>' # ./spec/spec_helper.rb:114:in 'block (2 levels) in <top (required)>'
Cleanup
Findings
Loose observations made during this:
Next steps
Getting this merged, and then continue upgrading.
Next up is an upgrade to Rails 7.2, and that can be started as soon as this has been merged.